<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>05-flex设置侧轴子元素排列方向</title>
  <style>
    div {
      /* 给父级添加flex布局属性才能够控制子元素哦 */
      display: flex;
      flex-direction: row;
      /* 水平居中效果： */
      /* 1. 设置主轴水平居中 */
      justify-content: center;
      /* 2. 设置侧轴水平居中 */
      /* algin-items: 适用于多行效果 */
      align-items: center;

      /* 侧轴默认顶部对齐 */
      align-items: flex-start;

      /* 侧轴设置拉伸：(子元素不要设置高度，拉伸会将子盒子拉伸到与父盒子同高) */
      align-items: stretch;

      width: 800px;
      height: 300px;
      margin: 0 auto;
      background-color: pink;
    }

    div span {
      width: 150px;
      /* height: 100px; */
      margin-left: 10px;
      background: skyblue;
    }
  </style>
</head>

<body>

  <div>
    <span>1</span>
    <span>2</span>
    <span>3</span>
  </div>

</body>

</html>